//
//  JQFYGratefulMusicianCollectionViewCell.m
//  JQFY
//
//  Created by 代辉 on 2017/10/30.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYGratefulMusicianCollectionViewCell.h"

@implementation JQFYGratefulMusicianCollectionViewCell {
    UIImageView *_coverImgView;
    UILabel *_songName;
    UILabel *_authLabel;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.backgroundColor = [UIColor clearColor];
    _coverImgView = [UIImageView new];
    _coverImgView.layer.cornerRadius = 8 *SCAL;
    _coverImgView.layer.masksToBounds = YES;
    [self.contentView addSubview:_coverImgView];
    [_coverImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(0 *SCAL);
        make.width.height.mas_equalTo(120 *SCAL);
    }];
    
    _songName = [UILabel new];
    _songName.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:_songName];
    _songName.textColor = [UIColor colorWithHex:0x666666];
    [_songName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_coverImgView.mas_bottom).offset(8 *SCAL);
        make.left.equalTo(_coverImgView);
        make.width.mas_equalTo(100 *SCAL);
    }];
    
    _authLabel = [UILabel new];
    _authLabel.textColor = [UIColor lightGrayColor];
    _authLabel.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:_authLabel];
    _authLabel.textColor = [UIColor colorWithHex:0x999999];
    [_authLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_coverImgView);
        make.width.mas_equalTo(100 *SCAL);
        make.top.equalTo(_songName.mas_bottom).offset(5 *SCAL);
    }];
}

- (void)setSongInfo:(JQFYSong *)songInfo
{
    _songInfo = songInfo;
    [_coverImgView sd_setImageWithURL:[NSURL URLWithString:songInfo.music_cover_path] placeholderImage:[UIImage imageNamed:@"2（合并）"]];
    _songName.text = songInfo.music_name;
    _authLabel.text = songInfo.music_auth;
}

@end
